﻿@using DCMS.ViewModel.Models.Sales;

@model ExchangeBillModel
@*打印区域*@
<div id="printData"></div>
<input asp-for="Id" type="hidden" />
<input asp-for="TerminalId" type="hidden" />
<input asp-for="SumAmount" type="hidden" />
<input asp-for="TBalance.OweCashBalance" type="hidden" />
<input asp-for="BillTypeEnumId" type="hidden" />

@if (!ViewData.ModelState.IsValid)
{
    <div class="alert alert-warning alert-dismissable mt10">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <div asp-validation-summary="All"></div>
    </div>
}

@if (Model.AuditedStatus || Model.ReversedStatus)
{
    @await Html.PartialAsync("_Watermark")
}

<div class="row">
    <div class="col-lg-12">
        <div class="form-horizontal" novalidate="novalidate">
            <div class="form-group mb10">
                <div class="col-sm-2">
                    <div class="input-group">
                        <input asp-for="TerminalName" class="form-control" placeholder="客户..." readonly="@(Model.AuditedStatus?"readonly":"")" />
                        <input asp-for="ChannelId" type="hidden" />
                        <span class="input-group-btn">
                            <button id="btn_search_customer" type="button" class="btn btn-default" @(Model.AuditedStatus ? "disabled" : "")>
                                <span class="glyphicon glyphicon-search"></span>
                            </button>
                        </span>
                    </div>
                </div>
                <div class="col-sm-2">
                    <dcms-select asp-for="BusinessUserId" asp-items="@Model.BusinessUsers" asp-default="请选择业务员" asp-disabled="@(Model.AuditedStatus)" />
                </div>
                <div class="col-sm-1">
                    <dcms-select asp-for="WareHouseId" asp-items="@Model.WareHouses" asp-default="请选择仓库" asp-disabled="@(Model.AuditedStatus)" />
                </div>
                <div class="col-sm-2">
                    <dcms-editor asp-for="TransactionDate" placeholder="交易日期..." asp-disabled="@(Model.AuditedStatus)" />
                </div>
                <div class="col-sm-5">
                    <dcms-input asp-for="Remark" class="form-control" placeholder="备注..." asp-readonly="@(Model.AuditedStatus)" />
                </div>
                @*<div class="col-sm-1">
                        <dcms-select-bool asp-for="IsMinUnitSale" asp-items="@(new string[] {  "是", "否"})" asp-default="按最小单位销售" asp-disabled="@(Model.AuditedStatus)" />
                    </div>*@
                @*<div class="col-sm-1">
                        <dcms-select asp-for="DefaultAmountId" asp-items="@Model.ExchangeBillDefaultAmounts" class="form-control" asp-disabled="@(Model.AuditedStatus)" asp-default="选择价格体系" />
                    </div>*@
            </div>
        </div>
    </div>
</div>

@if (Model.Id != 0 && !string.IsNullOrEmpty(@Model.BillBarCode))
{
    <div class="row mtn mb10">
        <div class="col-md-3 pt20">
            <div class="form-group mbn">
                <lable class="col-lg-3 control-label">单据编号：</lable>
                <div class="col-lg-9">
                    <input asp-for="BillNumber" class="form-control-bb input-sm pbn pln prn" readonly="readonly" />
                </div>
            </div>
        </div>
        @if (Model.SaleReservationBillId > 0)
        {
            <div class="col-md-3 pt20">
                <div class="form-group mbn">
                    <lable class="col-lg-3 control-label">关联订单：</lable>
                    <div class="col-lg-9">
                        <input asp-for="SaleReservationBillNumber" class="form-control-bb input-sm pbn pln prn" readonly="readonly" />
                    </div>
                </div>
            </div>
        }
        else
        {
            <div class="col-md-2 pt20"></div>
        }
        <div class="col-md-2 pt20">
            <div class="form-group mbn">
                <lable class="col-lg-3 control-label">制单：</lable>
                <div class="col-lg-9">
                    <input asp-for="MakeUserName" class="form-control-bb input-sm pbn pln prn" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="col-md-2 pt20">
            <div class="form-group mbn">
                <lable class="col-lg-3 control-label">审核：</lable>
                <div class="col-lg-9">
                    <input asp-for="AuditedUserName" class="form-control-bb input-sm pbn pln prn" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <img class="media-object mn thumbnail pull-right" src="@Model.BillBarCode" />
        </div>
    </div>
}
else
{
    if (Model.SaleReservationBillId > 0)
    {
        <div class="row mtn mb10">
            <div class="col-md-3">
                <div class="form-group mbn">
                    <lable class="col-lg-3 control-label">关联订单：</lable>
                    <div class="col-lg-9">
                        <input asp-for="SaleReservationBillNumber" class="form-control-bb input-sm pbn pln prn" readonly="readonly" />
                    </div>
                </div>
            </div>
        </div>
    }
}


<div class="row mt10 mb10">
    <div class="col-md-12">
        <table class="table table-striped table-bordered table-hover" id="ExchangeItems"></table>
    </div>
</div>

@*打印区域*@
<div id="printData" />
